use Tk;
use utf8;
binmode(STDOUT, ":encoding(utf8)");

my $mw = MainWindow->new(-title => "基础组件示例");

# 标签
$mw->Label(-text => "请输入您的姓名:")->pack(-side => "left", -padx => 5);

# 文本框
my $entry = $mw->Entry(-width => 20)->pack(-side => "left", -padx => 5);

# 按钮
$mw->Button(-text => "确定", -command => sub {
    my $name = $entry->get();
    $mw->messageBox(-message => "您好, $name!");
})->pack(-side => "left", -padx => 5);

MainLoop;